// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 创建用户 POST /user/add */
export async function postUserAdd(body: API.UserAddRequest, options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/user/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取当前登录用户 GET /user/current */
export async function getUserCurrent(options?: { [key: string]: any }) {
  return request<API.BaseResponseUserVo>('/user/current', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 删除用户 POST /user/delete */
export async function postUserOpenApiDelete(
  body: API.DeleteRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>('/user/delete', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据id获取用户 GET /user/get/${param0} */
export async function getUserGetId(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUserGetIdParams,
  options?: { [key: string]: any },
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseUserVo>(`/user/get/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 获取用户列表 GET /user/list */
export async function getUserList(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUserListParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseListUserVo>('/user/list', {
    method: 'GET',
    params: {
      // sortField has a default value: id
      sortField: 'id',
      // sortOrder has a default value: asc
      sortOrder: 'asc',
      ...params,
    },
    ...(options || {}),
  });
}

/** 获取用户类表（分页） GET /user/list/page */
export async function getUserListPage(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getUserListPageParams,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponsePageResultUserVo>('/user/list/page', {
    method: 'GET',
    params: {
      // pageNum has a default value: 1
      pageNum: '1',
      // pageSize has a default value: 10
      pageSize: '10',

      // sortField has a default value: id
      sortField: 'id',
      // sortOrder has a default value: asc
      sortOrder: 'asc',
      ...params,
    },
    ...(options || {}),
  });
}

/** 用户登录 POST /user/login */
export async function postUserLogin(body: API.UserLoginRequset, options?: { [key: string]: any }) {
  return request<API.BaseResponseUserVo>('/user/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 用户注销 POST /user/logout */
export async function postUserLogout(options?: { [key: string]: any }) {
  return request<API.BaseResponseBoolean>('/user/logout', {
    method: 'POST',
    ...(options || {}),
  });
}

/** 用户注册 POST /user/register */
export async function postUserRegister(
  body: API.UserRegisterRequset,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseLong>('/user/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新用户 POST /user/update */
export async function postUserUpdate(
  body: API.UserUpdateRequest,
  options?: { [key: string]: any },
) {
  return request<API.BaseResponseBoolean>('/user/update', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
